home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
gui
/
taskbar.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
3KB
|
89 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import wx
from gui.toolbox import to_icon
from weakref import WeakValueDictionary
from logging import getLogger
log = getLogger('taskbar')
class DigsbyTaskBarIcon(wx.TaskBarIcon):
def __init__(self, icon, menu = None, tooltip = None):
wx.TaskBarIcon.__init__(self)
if isinstance(icon, wx.WindowClass):
raise TypeError
self._tooltip = ''
if icon is not None:
self.SetIcon(icon, tooltip)
if menu is not None:
self.Menu = menu
if 'wxMac' not in wx.PlatformInfo:
self.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.OnRightUp)
def Destroy(self):
if getattr(self, '_icon_destroyed', False):
return log.critical('destroyed %r already. not destroying it again', self)
log.info('Destroying %r', self)
self._icon_destroyed = True
wx.TaskBarIcon.Destroy(self)
def OnRightUp(self, e):
menu = self.CreatePopupMenu()
if menu is not None:
menu.PopupMenu()
def CreatePopupMenu(self):
return self.Menu
def SetMenu(self, menu):
self._menu = menu
menu.Windowless = True
def GetMenu(self):
return getattr(self, '_menu', None)
Menu = property(GetMenu, SetMenu)
def SetIcon(self, icon_or_bitmap, tooltip = None):
size = self._IconSize
self._icon = to_icon(icon_or_bitmap.PIL.ResizedSmaller(size).ResizeCanvas(size, size))
if tooltip is None:
tooltip = self._tooltip
else:
self._tooltip = tooltip
wx.TaskBarIcon.SetIcon(self, self._icon, tooltip)
def GetIcon(self):
return self._icon
Icon = property(GetIcon, SetIcon)
def _IconSize(self):
size = 16
if 'wxMac' in wx.PlatformInfo:
size = 128
elif 'wxGTK' in wx.PlatformInfo:
get = wx.SystemSettings.GetMetric
size = get(wx.SYS_ICON_X)
size = 20
else:
get = wx.SystemSettings.GetMetric
size = get(wx.SYS_SMALLICON_X)
return size
_IconSize = property(_IconSize)